package com.derbysoft.dswitch.adapter.ihg.webservice.impl;

import com.derbysoft.dswitch.adapter.ihg.dto.Request;
import com.derbysoft.dswitch.adapter.ihg.dto.Response;
import com.derbysoft.dswitch.adapter.ihg.webservice.ProviderWebService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.oxm.jaxb.Jaxb2Marshaller;
import org.springframework.stereotype.Service;

import java.util.List;

@Service("bookingProviderWebService")
public class BookProviderWebServiceImpl<RQ extends Request, RS extends Response>
        extends AbstractProviderWebService<RQ, RS> implements ProviderWebService<RQ, RS> {

    @Autowired
    @Qualifier("jaxb2Marshaller")
    private Jaxb2Marshaller jaxb2Marshaller;

    @Override
    public RS invoke(RQ request, AccountProvider accountProvider) throws Exception {
        return super.invoke(jaxb2Marshaller, request, accountProvider);
    }

    @Override
    public List<ResponsePair<RQ, RS>> batchInvoke(List<RequestPair<RQ>> requests,
                                                  AccountProvider accountProvider) throws Exception {
        return super.batchInvoke(jaxb2Marshaller, requests, accountProvider);
    }
}
